package org.learn.test;
import java.util.Scanner;
public class SeqSearch {
    public static void main(String[] args) {
        String[] name = {"白眉鹰王", "金毛狮王", "紫衫龙王", "青翼蝠王"};
        System.out.println("请输入名字");
        Scanner myScanner = new Scanner(System.in);
        String findName = myScanner.next();
        //便利数组，逐一比较；
        int flg = -1;
        for (int i = 0; i < name.length; i++) {
            if (findName.equals(name[i])) {
                System.out.println("恭喜你找到" + findName);
                System.out.println("下标为" + i);
                flg = i;
                break;
            }

            }
        if (flg == -1) {
            System.out.println("很遗憾你没有找到");
        }
    }
}
